package com.lhz.manager;

import com.lhz.model.constant.RunnableConstant;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * @Author: LiHuaZhi
 * @Date: 2020/9/25 21:53
 * @Description:
 **/
@Configuration
public class JobThread {
    @Bean("jobScheduler")
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setThreadNamePrefix("JobThread - ");
        scheduler.setPoolSize(RunnableConstant.MAX_NUM);
        return scheduler;
    }
}
